<?php

namespace common\models;

use Yii;
use yii\behaviors\TimestampBehavior;

/**
 * This is the model class for table "{{%ceping_paper_label}}".
 *
 * @property integer $paper_id
 * @property string $label_id
 * @property integer $weight
 * @property integer $status
 * @property string $created_at
 * @property string $updated_at
 * @property string $res1
 * @property string $res2
 * @property string $res3
 */
class PaperLabel extends \yii\db\ActiveRecord             //试卷与题（标签）对应表  未使用
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%ceping_paper_label}}';
    }
    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return [
            TimestampBehavior::className(),
        ];
    }
    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['paper_id', 'label_id'], 'required'],
            [[ 'weight', 'status'], 'integer'],
            [['label_id'], 'string', 'max' => 20],
            [['res1', 'res2', 'res3'], 'string', 'max' => 80]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'paper_id' => 'Paper ID',
            'label_id' => 'Label ID',
            'weight' => 'Weight',
            'status' => 'Status',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
            'res1' => 'Res1',
            'res2' => 'Res2',
            'res3' => 'Res3',
        ];
    }


    public function getRelationLabel()
    {
        return $this->hasOne(CepingLabel::className(), ['label_id' => 'label_id']);
    }
}
